package com.itheima.demo;

public class SilverCard extends Card{
    public SilverCard(String card, String name, String phone, double money) {
        super(card, name, phone, money);        //用父类构造器初始化
    }

    public void consume(double money) {
        System.out.println("您当前银卡的消费是" + money);
        System.out.println("优惠后的价格:" + money * 0.9);

        //判断卡内余额是否足够
        if(getMoney()<money*0.9){
            System.out.println("您余额是:" + getMoney() + ",当前余额不足");
            return;
        }
        //更新金卡账户的余额
        //getMoney()的钱是父类里的,this.money也是
        setMoney(getMoney() - money * 0.9);
    }
}
